package com.example.dao;

import com.example.entity.ActivityCollection;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ActivityCollectionDao {
    // 新增收藏
    int insert(ActivityCollection collection);

    // 根据ID删除收藏
    int deleteById(Integer collection_id);

    // 根据志愿者ID和活动ID删除收藏
    int deleteByVolunteerAndActivity(@Param("volunteer_id") Integer volunteer_id,
                                     @Param("activity_id") Integer activityId);

    // 根据志愿者ID查询收藏
    List<ActivityCollection> selectByVolunteerId(Integer volunteer_id);

    // 检查是否已收藏
    boolean existsByVolunteerAndActivity(@Param("volunteer_id") Integer volunteer_id,
                                         @Param("activity_id") Integer activityId);

    // 获取收藏详情
    ActivityCollection selectById(Integer collection_id);
}